<template>
  <div>
       <h2>学校名称：{{name}}</h2>
      <h2>学校地址：{{address}}</h2>
  </div>
</template>

<script>
import pubsub from 'pubsub-js'
export default {
    name:'School',
    data(){
        return{
            name:'深职院',
            address:'深圳'
        }
    },
    
    mounted() {
        // this.$bus.$on('StudentName',(data)=>{
        //     console.log('我是School组件，收到了Student组件的数据：@@'+data);
        // })
        pubsub.subscribe('hello',(msg,data)=>{
            console.log(msg,data);
        })
        // this.pubId=pubsub.subscribe('hello',function(msg,data){
        //     console.log(msg,data);
        // })
    },
    beforeDestroy() {
        // this.$bus.$off('hello')
        pubsub.unsubscribe(this.pubId)
    },

}
</script>

<style>

</style>